From 4c4f8214637ac8d19e16f71d20542982a5eedad7 Mon Sep 17 00:00:00 2001
From: real-zephex <zephex-1@outlook.com>
Date: Sat, 11 May 2024 01:33:00 +0530
Subject: UI changes, Logic change and complete re-write for anime page

---
 src/app/anime/[id]/page.jsx | 116 +++++++++++++++++++++++---------------------
 1 file changed, 61 insertions(+), 55 deletions(-)

(limited to 'src/app/anime/[id]/page.jsx')

diff --git a/src/app/anime/[id]/page.jsx b/src/app/anime/[id]/page.jsx
index d133118..7368e96 100644
--- a/src/app/anime/[id]/page.jsx
+++ b/src/app/anime/[id]/page.jsx
@@ -1,68 +1,74 @@
-import styles from "./info.module.css";
 import Image from "next/image";
-import Button from "./buttons";
-import { preFetchAnimeLinks } from "../videoLinkfetcher";
 
-export default async function AnimeInfo({ params }) {
-	let animeID = params.id;
+import { anime_info } from "../data-fetch/request";
+import styles from "../styles/info.module.css";
+import EpisodesButtons from "../components/episode_buttons";
 
-	const info = await getAnimeInfo(animeID);
+import { preFetchVideoLinks } from "../components/cacher";
 
-	preFetchAnimeLinks(info);
+const AnimeInfoHomepage = async ({ params }) => {
+	const id = params.id;
+	const data = await anime_info(id);
+
+	preFetchVideoLinks(data);
 
 	return (
-		<div className={styles.dramaInfoContainer}>
-			<div className={styles.dramaInfo}>
-				{info && (
-					<div>
-						<div className={styles.titleContainer}>
-							<p>{info.title}</p>
+		<main className={styles.main}>
+			<div>
+				{data && (
+					<section className={styles.AnimeInfo}>
+						<div className={styles.AnimeHeroSection}>
 							<Image
-								src={info.image}
-								width={180}
-								height={260}
-								alt="Drama"
-								priority
+								src={data.image}
+								width={200}
+								height={300}
+								alt="Anime Poster"
 							/>
+							<div>
+								<p className={styles.animeTitle}>
+									{data.title}
+								</p>
+								<p className={styles.animeDescription}>
+									<strong>Description: </strong>
+									{data.description}
+								</p>
+								<hr style={{ borderColor: "gray" }} />
+								<span>
+									<strong style={{ marginRight: 5 }}>
+										Genres:
+									</strong>
+									{data.genres &&
+										data.genres.map((item, index) => (
+											<span key={index}>
+												{item}
+												{index !==
+													data.genres.length - 1 &&
+													", "}
+											</span>
+										))}
+								</span>
+								<p>
+									<strong>Episodes:</strong>{" "}
+									{data.totalEpisodes}
+								</p>
+								<p>
+									<strong>Release year:</strong>{" "}
+									{data.releaseDate}
+								</p>
+								<p>
+									<strong>Status:</strong> {data.status}
+								</p>
+								<p>
+									<strong>Type:</strong> {data.type}
+								</p>
+							</div>
 						</div>
-						<div className={styles.animeDescription}>
-							<h2>Description</h2>
-							<p>{info.description}</p>
-						</div>
-					</div>
+					</section>
 				)}
-
-				<div className={styles.animeDetails}>
-					<span className={styles.genre}>Genres: </span>
-					{info.genres &&
-						info.genres.map((item, index) => (
-							<span className={styles.genreEntries} key={index}>
-								{item}
-							</span>
-						))}
-					<p className={styles.animeType}>
-						Type: <span>{info && info.type}</span>
-					</p>
-					<p className={styles.animeRelease}>
-						Release year:
-						<span>
-							{" "}
-							{info && info.releaseDate}, {info && info.status}
-						</span>
-					</p>
-				</div>
-
-				<Button data2={info} />
 			</div>
-		</div>
+			<EpisodesButtons data={data} />
+		</main>
 	);
-}
+};
 
-async function getAnimeInfo(anime_id) {
-	const res = await fetch(
-		"https://consumet-jade.vercel.app/anime/gogoanime/info/" + anime_id,
-		{ next: { revalidate: 7200 } }
-	);
-	const data = await res.json();
-	return data;
-}
+export default AnimeInfoHomepage;
-- 
cgit v1.2.3


From 513eb617bc627bdc406eddd0f3124411017cbe50 Mon Sep 17 00:00:00 2001
From: real-zephex <zephex-1@outlook.com>
Date: Sat, 11 May 2024 01:42:48 +0530
Subject: adjustments to the cache system

---
 src/app/anime/[id]/page.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/app/anime/[id]/page.jsx')

diff --git a/src/app/anime/[id]/page.jsx b/src/app/anime/[id]/page.jsx
index 7368e96..0b85e8e 100644
--- a/src/app/anime/[id]/page.jsx
+++ b/src/app/anime/[id]/page.jsx
@@ -10,7 +10,7 @@ const AnimeInfoHomepage = async ({ params }) => {
 	const id = params.id;
 	const data = await anime_info(id);
 
-	preFetchVideoLinks(data);
+	preFetchVideoLinks(data.episodes.slice(0, 49));
 
 	return (
 		<main className={styles.main}>
-- 
cgit v1.2.3


From 6c56263791c80676518532c9f91e0fb3d84fd079 Mon Sep 17 00:00:00 2001
From: real-zephex <zephex-1@outlook.com>
Date: Sat, 11 May 2024 02:01:28 +0530
Subject: adjustments to the cache system

---
 src/app/anime/[id]/page.jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/app/anime/[id]/page.jsx')

diff --git a/src/app/anime/[id]/page.jsx b/src/app/anime/[id]/page.jsx
index 0b85e8e..edd100a 100644
--- a/src/app/anime/[id]/page.jsx
+++ b/src/app/anime/[id]/page.jsx
@@ -10,7 +10,8 @@ const AnimeInfoHomepage = async ({ params }) => {
 	const id = params.id;
 	const data = await anime_info(id);
 
-	preFetchVideoLinks(data.episodes.slice(0, 49));
+	const sliceLength = Math.min(data.episodes.length, 49);
+	preFetchVideoLinks(data.episodes.slice(0, sliceLength));
 
 	return (
 		<main className={styles.main}>
-- 
cgit v1.2.3


From b69507f771d09ac07f679c8eabf420e7558f9b7c Mon Sep 17 00:00:00 2001
From: real-zephex <zephex-1@outlook.com>
Date: Sat, 11 May 2024 09:15:12 +0530
Subject: some minor fixes

---
 src/app/anime/[id]/page.jsx | 1 +
 1 file changed, 1 insertion(+)

(limited to 'src/app/anime/[id]/page.jsx')

diff --git a/src/app/anime/[id]/page.jsx b/src/app/anime/[id]/page.jsx
index edd100a..f107313 100644
--- a/src/app/anime/[id]/page.jsx
+++ b/src/app/anime/[id]/page.jsx
@@ -24,6 +24,7 @@ const AnimeInfoHomepage = async ({ params }) => {
 								width={200}
 								height={300}
 								alt="Anime Poster"
+								priority
 							/>
 							<div>
 								<p className={styles.animeTitle}>
-- 
cgit v1.2.3

